import React, { useState } from 'react'
import { NavBar,ProductCard} from 'react-vant';
import { useNavigate } from 'react-router-dom'
export default function Gwc() {
  const navigate=useNavigate()
  const [gwcq,setGwcq]=useState([])
  const [list,setList]=useState([])
  gwcq.push(JSON.parse(localStorage.getItem("car")));
  [...gwcq].map((item,ind)=>{
    item.map((item,ind)=>{
      list.push(item)
    })
  })
 
  return (
    <div>
      <NavBar
      title="购物车"
      leftText="返回"
      onClickLeft={() => navigate('/zhut/home')}
    />
      {list.length>0 ? (list.map((item,ind)=>(<div key={ind}>
        <ProductCard
          price={item.price}
          desc={item.word}
          title={item.title}
          thumb={item.img}
        />
      </div>))):('购物车为空')}
    </div>
  )
}
